import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

/**
 * 拉卡拉商户进件实体
 */
@Entity('lakala_merchant')
export class LakalaMerchantEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '商户号（本地）', unique: true })
  merchantNo: string;

  @Column({ comment: '拉卡拉商户号', nullable: true })
  lakalaMerchantNo: string;

  @Column({ comment: '商户名称' })
  merchantName: string;

  @Column({ comment: '商户类型' })
  merchantType: string; // enterprise, individual

  @Column({ comment: '营业执照号' })
  businessLicense: string;

  @Column({ comment: '法人姓名' })
  legalPerson: string;

  @Column({ comment: '联系电话' })
  contactPhone: string;

  @Column({ comment: '联系邮箱' })
  contactEmail: string;

  @Column({ comment: '银行账户' })
  bankAccount: string;

  @Column({ comment: '开户银行' })
  bankName: string;

  @Column({ comment: '进件状态', default: 'applying' })
  status: string; // applying, submitted, approved, rejected, failed

  @Column({ comment: '提交时间', nullable: true })
  submitTime: Date;

  @Column({ comment: '审核时间', nullable: true })
  auditTime: Date;

  @Column({ comment: '审核备注', nullable: true })
  auditRemark: string;

  @Column({ comment: '失败原因', nullable: true })
  failReason: string;

  @Column({ comment: '请求数据', type: 'text' })
  requestData: string;

  @Column({ comment: '拉卡拉响应数据', type: 'text', nullable: true })
  lakalaResponse: string;

  @Column({ comment: '备注', nullable: true })
  remark: string;

  @CreateDateColumn({ comment: '创建时间' })
  createdAt: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updatedAt: Date;
}